package com.smart.springaiopen.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Guoxinyu
 * @description: TODO
 * @date 2025-05-27 22:37
 * @email gxy06x@qq.com
 */
@RestController
public class DeepSeekController {
    private static final Logger log = LoggerFactory.getLogger(DeepSeekController.class);
    @Autowired
    private OpenAiChatModel chatModel;
    @GetMapping("/ai/generate")
    public String generate(@RequestParam(value = "prompt", defaultValue = "hello")  String prompt) {
        String resp = this.chatModel.call(prompt);
        log.info("resp:{}", resp);
        return resp;
    }
}
